package com.boonya.hibernate.entity;

import javax.persistence.*;
import java.util.Objects;

/**
 * @ClassName: Student
 * @Description: TODO(功能说明)
 * @author: pengjunlin
 * @motto: 学习需要毅力，那就秀毅力
 * @date 2021/5/10 23:43
 */
@Entity
@Table(name = "students", schema = "test", catalog = "")
public class Student {
    private int id;
    private String name;
    private String sex;
    private Integer age;
    private Double sum;

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "sex")
    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Basic
    @Column(name = "age")
    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Basic
    @Column(name = "sum")
    public Double getSum() {
        return sum;
    }

    public void setSum(Double sum) {
        this.sum = sum;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return id == student.id &&
            Objects.equals(name, student.name) &&
            Objects.equals(sex, student.sex) &&
            Objects.equals(age, student.age) &&
            Objects.equals(sum, student.sum);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, sex, age, sum);
    }
}
